Skip to contentMethod: computeNextMove(int, KopfundZahlundKantePlayer, KopfundZahlundKanteState)
      1: package de.fhdw.gaming.ipspiel22.kopfundzahlundkante.strategy;
2: 
3: import java.util.Optional;
4: 
5: import de.fhdw.gaming.ipspiel22.kopfundzahlundkante.domain.KopfundZahlundKantePlayer;
6: import de.fhdw.gaming.ipspiel22.kopfundzahlundkante.domain.KopfundZahlundKanteState;
7: import de.fhdw.gaming.ipspiel22.kopfundzahlundkante.domain.KopfundZahlundKanteStrategy;
8: import de.fhdw.gaming.ipspiel22.kopfundzahlundkante.moves.KopfundZahlundKanteMove;
9: import de.fhdw.gaming.ipspiel22.kopfundzahlundkante.moves.factory.KopfundZahlundKanteMoveFactory;
10: 
11: /**
12:  * Implements {@link KopfundZahlundKanteStrategy} by always saying "Edge".
13:  */
14: public final class KopfundZahlundKanteKanteStrategy implements KopfundZahlundKanteStrategy {
15: 
16:     /**
17:      * The factory for creating KopfundZahl moves.
18:      */
19:     private final KopfundZahlundKanteMoveFactory moveFactory;
20:     
21:     /**
22:      * Creates an {@link KopfundZahlundKanteKanteStrategy}.
23:      *
24:      * @param moveFactory The factory for creating KopfundZahl moves.
25:      */
26:     KopfundZahlundKanteKanteStrategy(final KopfundZahlundKanteMoveFactory moveFactory) {
27:         this.moveFactory = moveFactory;
28:     }
29:     
30:     @Override
31:     public Optional<KopfundZahlundKanteMove> computeNextMove(final int gameId, final KopfundZahlundKantePlayer player,
32:             final KopfundZahlundKanteState state) {
33:         return Optional.of(this.moveFactory.createEdgeMove());
34:     }
35:     
36:     @Override
37:     public String toString() {
38:         return KopfundZahlundKanteKanteStrategy.class.getSimpleName();
39:     }
40: 
41: }